package main

import (
	"SExcelHelper/sexcel"
	"fmt"
)

type Data struct {
	Name string `xlsx:"姓名"`
	Sex  string `xlsx:"性别"`
	Year int    `xlsx:"年"`
}

// 测试入口
func main() {

	se := sexcel.NewSexcelSheet("第一个")

	var list = []Data{
		{"姓名1", "男", 1}, {"姓名2", "男", 2}, {"姓名3", "女", 3},
	}

	sexcel.HeaderR = 1
	sexcel.HeaderC = 1
	sexcel.DataR = 3
	sexcel.DataC = 2

	var merge = []sexcel.MergeCellType{
		{FieldNameS: "A1", FieldNameE: "A2"}, {FieldNameS: "B1", FieldNameE: "B2"}, {FieldNameS: "C1", FieldNameE: "C2"},
	}

	//var a = make([]*sexcel.MergeCellType, 0)
	//var mod = new(sexcel.MergeCellType)
	//mod.FieldNameS = "A1"
	//mod.FieldNameE = "A2"
	//a = append(a, mod)
	//var mod1 = new(sexcel.MergeCellType)
	//mod1.FieldNameS = "B1"
	//mod1.FieldNameE = "B2"
	//a = append(a, mod1)
	//var mod2 = new(sexcel.MergeCellType)
	//mod2.FieldNameS = "C1"
	//mod2.FieldNameE = "C2"
	//a = append(a, mod2)

	//var merge1 = []string{
	//	"A1:A2", "B1:B2", "C1:C2",
	//}

	se.MergeCells(merge)

	se.ListToExcel(list)

	if err := se.SaveAs("Book1.xlsx"); err != nil {
		fmt.Println(err)
	}

}
